<template>
  <Portlet title="异常信息">
    <el-form label-position="left" label-width="100px">
      <el-row :gutter="15">
        <el-col :md="12" :lg="8" :xl="6">
          <el-form-item label="发起人：">
            <span>{{chAbnormal.founderName}}</span>
          </el-form-item>
        </el-col>
        <el-col :md="12" :lg="8" :xl="6">
          <el-form-item label="发起时间：">
            <span>{{chAbnormal.foundDate | unixTimestampFilter}}</span>
          </el-form-item>
        </el-col>
        <el-col :md="12" :lg="8" :xl="6">
          <el-form-item label="异常流水号：">
            <span>{{chAbnormal.abnormalSerNo}}</span>
          </el-form-item>
        </el-col>
        <el-col :md="12" :lg="8" :xl="6">
          <el-form-item label="异常类型：">
            <span>{{chAbnormal.abnormalType}}</span>
          </el-form-item>
        </el-col>
        <el-col :md="12" :lg="8" :xl="6">
          <el-form-item label="异常包件：">
            <span>{{chAbnormal.abnormalPacks}} 件</span>
          </el-form-item>
        </el-col>
        <el-col :md="12" :lg="8" :xl="6">
          <el-form-item label="异常描述：">
            <span>{{chAbnormal.abnormalMemo}}</span>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="15">
        <el-col :md="24" :lg="16" :xl="12">
          <el-form-item label="异常附件：">
            <Upload-image :formData="{}" :value="getVoucher" :readonly="true"></Upload-image>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </Portlet>
</template>
<script>
// import Portlet from '@/components/base/Portlet'
// import UploadImage from '@/components/base/UploadImage.vue'
import {dotData} from '@/utils'
import {unixTimestampFilter} from '@/filters'
export default {
  name: 'AbnormalModule',
  components: {
  },
  filters: {
    unixTimestampFilter
  },
  props: {
    detail: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      activeName: 'first',
      imgArr: []
    }
  },
  computed: {
    chAbnormal() {
      return dotData(this.detail, 'chAbnormal') || {}
    },
    getVoucher() {
      const img = dotData(this.detail, 'chAbnormal.abnormalPicture')
      if (Array.isArray(img)) {
        return img
      }
      if (img && typeof img === 'string') {
        return img.split(',')
      }
      return []
    }
  }
}
</script>
